package com.jrx.anytxn.customer;

import org.apache.rocketmq.client.log.ClientLogger;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;

@SpringBootApplication(scanBasePackages={"com.jrx.anytxn","jrx.auth.filter"})
@EnableFeignClients(basePackages = {"com.jrx.anytxn.feign"})
@EnableDiscoveryClient
@EnableTransactionManagement
@EnableAsync
@MapperScan({"com.jrx.anytxn.customer.mapper", "com.jrx.anytxn.param.mapper"})
public class AnytxnCustomerApiApplication {

	@Bean
	public PlatformTransactionManager txManager(DataSource dataSource) {
		return new DataSourceTransactionManager(dataSource);
	}

	public static void main(String[] args) {
		System.setProperty(ClientLogger.CLIENT_LOG_USESLF4J, "true");
		SpringApplication.run(AnytxnCustomerApiApplication.class, args);
	}

}

